/**
 * \file       dolphin.h
 * \brief      header file for dolphin.cpp
 * \version    1.0
 * \author     dragon,chinagnu@gmail.com
 * \date       2008-05-02
 * \remarks    there is initial Version
 * \bug        unknown
 * \todo       head for create dolphin media player GUI
 *
 * <HR>
 * \version    1.1
 * \author     dragon,chinagnu@gmail.com
 * \date       2008-05-06
 * \remarks    modify some funtions defination.
 *
 * <HR>
 * \version    1.2
 * \author     dragon,chinagnu@gmail.com
 * \date       2008-05-08
 * \remarks    rename OnSearch to OnAddDir,add OnAddFile
 *
 * <HR>
 * \version    1.3
 * \author     dragon,chinagnu@gmail.com
 * \date       2008-05-08
 * \remarks    add enum invation name p_mode which is the current play mode flag
 *
 * <HR>
 * \version    1.4
 * \author     dragon,chinagnu@gmail.com
 * \date       2008-05-08
 * \remarks    add new method GetIndexOfSearchFile into class dolphin which help 
 *             get index of play list with search name
 */

#ifndef    dolphin_H
#define    dolphin_H

#include "dragon.h"
#include "icon.h"
#include "xml.h"
#include "process.h"
#include "random.h"

/** current play mode defination  */
#define	 NORMAL_MODE   0
#define  LOOP_MODE     1
#define	 RADOM_MODE    2

/// Init with wxWidget Library that is the main of this program.
class Dragon:public wxApp
{
	 bool OnInit(void);
	 int OnExit(void);

private:
	 /** creat a handle of wxSigleInstanceChecker, which will 
	     need to check this program's status */
	 wxSingleInstanceChecker *m_checker;
};


/// Creat GUI and Event Manage system for dolphin Media Player Version 
class dolphin:public wxFrame
{
public:
	 dolphin(wxFrame *parent, 
			 const wxString& title,
			 const wxPoint& pos,
			 const wxSize& size);
	 ~dolphin(void);

	 void Init(void);
	 void LoadPlayList(wxString conf_file);
	 wxPanel* CreateMedaiEngineer(wxWindow *parent,int width, int heigh);
	 wxPanel* CreatePlayList(wxWindow *parent, int width,int heigh);
	 void GetVolume(wxMediaCtrl *engineer,wxSlider *volume);
	 void SetVolume(wxMediaCtrl *engineer,wxSlider *volume);
	 void OnSelect(wxListEvent& event);
	 void OnProcess(wxListEvent& event);
	 void OnPause(wxCommandEvent& WXUNUSED(event));
	 void OnMulitMode(wxMediaEvent& WXUNUSED(event));
	 void OnProgress(wxTimerEvent& event);
	 void OnSetVolume(wxCommandEvent& WXUNUSED(event));
	 void OnQuit(wxCommandEvent& WXUNUSED(event));
	 void OnExit(wxCloseEvent& WXUNUSED(event));
	 void OnAddDir(wxCommandEvent& WXUNUSED(event));
	 void OnAddFile(wxCommandEvent& WXUNUSED(event));
	 void OnPrev(wxCommandEvent& WXUNUSED(event));
	 void OnNext(wxCommandEvent& WXUNUSED(event));
	 void OnSearch(wxCommandEvent& WXUNUSED(event));
	 void OnAbout(wxCommandEvent& WXUNUSED(event));

	 wxMediaCtrl *m_media;
	 wxListCtrl *m_list;
	 wxSearchCtrl* m_search;
	 wxSlider* m_volum;
	 wxGauge *progress;
	 wxStaticText *progress_info;

protected:
	 /**class handle of Icon witch need to set icon of main window on bar*/
	 Icon   *m_Icon;
	 MediaProcess *process;
	 XMLProcess *m_xml;

private:
	 int loop_id,radom_id;
	 wxTimer m_timer;
	 wxArrayString *c_list;
	 class random rmd;
	 wxCollapsiblePane *m_collpane;

	 void ChangStatus(void);
	 int GetIndexOfSearchFile(wxString target);
	 void PlayNext(wxMediaCtrl* engineer,wxArrayString *list);
	 void PlayRandom(wxMediaCtrl* engineer,wxArrayString* list);
	 void OnRadom(wxUpdateUIEvent& event);
	 void OnRadomMode(wxCommandEvent& event);
	 void OnLoop(wxUpdateUIEvent& event);
	 void OnLoopMode(wxCommandEvent& event);

};

#endif
